/** \file vector_test.cpp Unit test to check proper behaviour of the core::vector class template
 *  \author Adrian Schweizer
 *  \created  $Fr 23 Nov 08:26:39 pm CET 2007 schwadri@SchwadriLaptop.local$
 *  \modified $Fr 23 Nov 09:24:08 pm CET 2007 schwadri@SchwadriLaptop.local$
 */

#define BOOST_TEST_MODULE core::math::vector test
#include <boost/test/unit_test.hpp>

#define CORE_MATH_LIMIT_VECTOR_DIMENSION 4
#include "../vector.hpp"

namespace cm = core::math;

BOOST_AUTO_TEST_CASE(core_math_vector_test)
{
    //trivial constructor
    //cm::vector<int, 0>  v0;
    //cm::vector<int, 1>  v1;
    cm::vector<int, 2>  v2;
    cm::vector<int, 3>  v3;
    cm::vector<int, 4>  v4;

    //predefined shortcut types
    cm::vector2f    f0;
    cm::vector3f    f1;
    cm::vector4f    f4;
    cm::vector2i    i0;
    cm::vector3i    i1;
    cm::vector4i    i4;

    //cpy constructor
    cm::vector4i    cp(i4);

    //std assignement

    v4  =   i4;

    //multiple valued constructor
    cm::vector2i    a(0,2);
    cm::vector3i    b(0,2,1);
    cm::vector4i    c(0,3,4,6);

    //test comma init
    //
    v2 = 1,23;
    BOOST_REQUIRE_EQUAL(v2,cm::vector2i(1,23));
    //v2.normalize();
    BOOST_REQUIRE(v2 != cm::vector2i(1,23));

    //check single element access
    v2[0] = 19;

    //check arithmetic inline member operators
    v2 -= 19;
    v2 *= 12;
    v2 /= 7;
    v2 += 9;

    //check iterator interface
    using std::transform;
    transform(v2.begin(),v2.end(),v2.begin(),std::bind2nd(std::plus<int>(),1));
    BOOST_REQUIRE(v2 != cm::vector2i(1,2));

    //additional ops

}
